﻿


using System;
using System.ComponentModel;
using System.Linq;

namespace FusionDB
{
    
    
    
    
    /// <summary>
    /// A class which represents the Products table in the FusionDB Database.
    /// This class is queryable through FusionDBDB.Product 
    /// </summary>

	public partial class Product: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public Product(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnProductIdChanging(int value);
        partial void OnProductIdChanged();
		
		private int _ProductId;
		public int ProductId { 
		    get{
		        return _ProductId;
		    } 
		    set{
		        this.OnProductIdChanging(value);
                this.SendPropertyChanging();
                this._ProductId = value;
                this.SendPropertyChanged("ProductId");
                this.OnProductIdChanged();
		    }
		}
		
        partial void OnNameChanging(string value);
        partial void OnNameChanged();
		
		private string _Name;
		public string Name { 
		    get{
		        return _Name;
		    } 
		    set{
		        this.OnNameChanging(value);
                this.SendPropertyChanging();
                this._Name = value;
                this.SendPropertyChanged("Name");
                this.OnNameChanged();
		    }
		}
		
        partial void OnPriceChanging(decimal? value);
        partial void OnPriceChanged();
		
		private decimal? _Price;
		public decimal? Price { 
		    get{
		        return _Price;
		    } 
		    set{
		        this.OnPriceChanging(value);
                this.SendPropertyChanging();
                this._Price = value;
                this.SendPropertyChanged("Price");
                this.OnPriceChanged();
		    }
		}
		
        partial void OnImageChanging(string value);
        partial void OnImageChanged();
		
		private string _Image;
		public string Image { 
		    get{
		        return _Image;
		    } 
		    set{
		        this.OnImageChanging(value);
                this.SendPropertyChanging();
                this._Image = value;
                this.SendPropertyChanged("Image");
                this.OnImageChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        public IQueryable<Order> Orders
        {
            get
            {
                  var db=new FusionDB.FusionDBDB();
                  return from items in db.Orders
                       where items.OrderId == _ProductId
                       select items;
            }
        }

        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the Customers table in the FusionDB Database.
    /// This class is queryable through FusionDBDB.Customer 
    /// </summary>

	public partial class Customer: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public Customer(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnCustomerIdChanging(int value);
        partial void OnCustomerIdChanged();
		
		private int _CustomerId;
		public int CustomerId { 
		    get{
		        return _CustomerId;
		    } 
		    set{
		        this.OnCustomerIdChanging(value);
                this.SendPropertyChanging();
                this._CustomerId = value;
                this.SendPropertyChanged("CustomerId");
                this.OnCustomerIdChanged();
		    }
		}
		
        partial void OnNameChanging(string value);
        partial void OnNameChanged();
		
		private string _Name;
		public string Name { 
		    get{
		        return _Name;
		    } 
		    set{
		        this.OnNameChanging(value);
                this.SendPropertyChanging();
                this._Name = value;
                this.SendPropertyChanged("Name");
                this.OnNameChanged();
		    }
		}
		
        partial void OnEmailChanging(string value);
        partial void OnEmailChanged();
		
		private string _Email;
		public string Email { 
		    get{
		        return _Email;
		    } 
		    set{
		        this.OnEmailChanging(value);
                this.SendPropertyChanging();
                this._Email = value;
                this.SendPropertyChanged("Email");
                this.OnEmailChanged();
		    }
		}
		
        partial void OnTelephoneChanging(string value);
        partial void OnTelephoneChanged();
		
		private string _Telephone;
		public string Telephone { 
		    get{
		        return _Telephone;
		    } 
		    set{
		        this.OnTelephoneChanging(value);
                this.SendPropertyChanging();
                this._Telephone = value;
                this.SendPropertyChanged("Telephone");
                this.OnTelephoneChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the Test table in the FusionDB Database.
    /// This class is queryable through FusionDBDB.Test 
    /// </summary>

	public partial class Test: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public Test(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnTestIdChanging(int value);
        partial void OnTestIdChanged();
		
		private int _TestId;
		public int TestId { 
		    get{
		        return _TestId;
		    } 
		    set{
		        this.OnTestIdChanging(value);
                this.SendPropertyChanging();
                this._TestId = value;
                this.SendPropertyChanged("TestId");
                this.OnTestIdChanged();
		    }
		}
		
        partial void OnTestNameChanging(string value);
        partial void OnTestNameChanged();
		
		private string _TestName;
		public string TestName { 
		    get{
		        return _TestName;
		    } 
		    set{
		        this.OnTestNameChanging(value);
                this.SendPropertyChanging();
                this._TestName = value;
                this.SendPropertyChanged("TestName");
                this.OnTestNameChanged();
		    }
		}
		
        partial void OnMestNameChanging(string value);
        partial void OnMestNameChanged();
		
		private string _MestName;
		public string MestName { 
		    get{
		        return _MestName;
		    } 
		    set{
		        this.OnMestNameChanging(value);
                this.SendPropertyChanging();
                this._MestName = value;
                this.SendPropertyChanged("MestName");
                this.OnMestNameChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the Employees table in the FusionDB Database.
    /// This class is queryable through FusionDBDB.Employee 
    /// </summary>

	public partial class Employee: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public Employee(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnIdChanging(int value);
        partial void OnIdChanged();
		
		private int _Id;
		public int Id { 
		    get{
		        return _Id;
		    } 
		    set{
		        this.OnIdChanging(value);
                this.SendPropertyChanging();
                this._Id = value;
                this.SendPropertyChanged("Id");
                this.OnIdChanged();
		    }
		}
		
        partial void OnNameChanging(string value);
        partial void OnNameChanged();
		
		private string _Name;
		public string Name { 
		    get{
		        return _Name;
		    } 
		    set{
		        this.OnNameChanging(value);
                this.SendPropertyChanging();
                this._Name = value;
                this.SendPropertyChanged("Name");
                this.OnNameChanged();
		    }
		}
		
        partial void OnEmailChanging(string value);
        partial void OnEmailChanged();
		
		private string _Email;
		public string Email { 
		    get{
		        return _Email;
		    } 
		    set{
		        this.OnEmailChanging(value);
                this.SendPropertyChanging();
                this._Email = value;
                this.SendPropertyChanged("Email");
                this.OnEmailChanged();
		    }
		}
		
        partial void OnSalaryChanging(decimal value);
        partial void OnSalaryChanged();
		
		private decimal _Salary;
		public decimal Salary { 
		    get{
		        return _Salary;
		    } 
		    set{
		        this.OnSalaryChanging(value);
                this.SendPropertyChanging();
                this._Salary = value;
                this.SendPropertyChanged("Salary");
                this.OnSalaryChanged();
		    }
		}
		
        partial void OnHireDateChanging(DateTime value);
        partial void OnHireDateChanged();
		
		private DateTime _HireDate;
		public DateTime HireDate { 
		    get{
		        return _HireDate;
		    } 
		    set{
		        this.OnHireDateChanging(value);
                this.SendPropertyChanging();
                this._HireDate = value;
                this.SendPropertyChanged("HireDate");
                this.OnHireDateChanged();
		    }
		}
		
        partial void OnActiveChanging(bool value);
        partial void OnActiveChanged();
		
		private bool _Active;
		public bool Active { 
		    get{
		        return _Active;
		    } 
		    set{
		        this.OnActiveChanging(value);
                this.SendPropertyChanging();
                this._Active = value;
                this.SendPropertyChanged("Active");
                this.OnActiveChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
    
    
    /// <summary>
    /// A class which represents the Orders table in the FusionDB Database.
    /// This class is queryable through FusionDBDB.Order 
    /// </summary>

	public partial class Order: INotifyPropertyChanging, INotifyPropertyChanged
	{
        partial void OnLoaded();
        partial void OnValidate(System.Data.Linq.ChangeAction action);
        partial void OnCreated();
	    
	    public Order(){
	        OnCreated();
	    }
	    
	    #region Properties
	    
        partial void OnOrderIdChanging(int value);
        partial void OnOrderIdChanged();
		
		private int _OrderId;
		public int OrderId { 
		    get{
		        return _OrderId;
		    } 
		    set{
		        this.OnOrderIdChanging(value);
                this.SendPropertyChanging();
                this._OrderId = value;
                this.SendPropertyChanged("OrderId");
                this.OnOrderIdChanged();
		    }
		}
		
        partial void OnCustomerIdChanging(int value);
        partial void OnCustomerIdChanged();
		
		private int _CustomerId;
		public int CustomerId { 
		    get{
		        return _CustomerId;
		    } 
		    set{
		        this.OnCustomerIdChanging(value);
                this.SendPropertyChanging();
                this._CustomerId = value;
                this.SendPropertyChanged("CustomerId");
                this.OnCustomerIdChanged();
		    }
		}
		
        partial void OnProductIdChanging(int value);
        partial void OnProductIdChanged();
		
		private int _ProductId;
		public int ProductId { 
		    get{
		        return _ProductId;
		    } 
		    set{
		        this.OnProductIdChanging(value);
                this.SendPropertyChanging();
                this._ProductId = value;
                this.SendPropertyChanged("ProductId");
                this.OnProductIdChanged();
		    }
		}
		
        partial void OnCreatedDateChanging(DateTime value);
        partial void OnCreatedDateChanged();
		
		private DateTime _CreatedDate;
		public DateTime CreatedDate { 
		    get{
		        return _CreatedDate;
		    } 
		    set{
		        this.OnCreatedDateChanging(value);
                this.SendPropertyChanging();
                this._CreatedDate = value;
                this.SendPropertyChanged("CreatedDate");
                this.OnCreatedDateChanged();
		    }
		}
		

        #endregion

        #region Foreign Keys
        public IQueryable<Product> Products
        {
            get
            {
                  var db=new FusionDB.FusionDBDB();
                  return from items in db.Products
                       where items.ProductId == _OrderId
                       select items;
            }
        }

        #endregion


        private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty);
        public event PropertyChangingEventHandler PropertyChanging;
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void SendPropertyChanging()
        {
            var handler = PropertyChanging;
            if (handler != null)
               handler(this, emptyChangingEventArgs);
        }

        protected virtual void SendPropertyChanged(String propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
        }

	}
	
}